home *** CD-ROM | disk | FTP | other *** search
- /*
- SNEWS 2.0
-
- Private decls the SNEWS news reader
-
-
- Copyright (C) 1991 John McCombs, Christchurch, NEW ZEALAND
- john@ahuriri.gen.nz
- PO Box 2708, Christchurch, NEW ZEALAND
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License, version 1, as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- See the file COPYING, which contains a copy of the GNU General
- Public License.
-
- */
-
- /*---------------------------- Source Control ------------------------------*/
-
- /*
- * $Id: SNEWS.H,v 1.2 1994/02/05 18:45:50 gbj Exp user $
- */
-
- /****************************************************************************
- * 22 May 92 1.2 GT Enable "INCLUDE_SIG". *
- * 09 Jun 92 1.3 GT Right and left cursor keys. *
- * 26 Jun 92 1.4 GT Fix length of TEXT->post_date. *
- * 17 Jul 92 1.5 GT C++ compilation. *
- * 16 Aug 92 1.6 MSM Snews 1.90 *
- * Lock file support *
- * 31 May 93 1.7 MSM Snews 2.0 *
- * 26 Sep 93 1.8 MSM Snews 1.24 *
- * 2 Apr 94 1.9 MSM Snews 1.28 *
- ****************************************************************************/
-
- #ifdef __TURBOC__
- # include <alloc.h>
- #else
- # ifndef ATARI
- # include <malloc.h>
- # endif
- #endif
- #include <process.h>
- #include <io.h>
- #include <ctype.h>
-
- #define INCLUDE_SIG /* enable this to have the reply function put */
- /* your sig on the reply - mail ususally does */
- /* this */
-
- #define MAXLINE 1024 /* Snews 2.0 */
- #define MAXART 256 /* Snews 2.0 */
-
- #define ENTER 0x0D
- #define ESCAPE 0x1B
- #define TAB 0x09
- #define BACKSP 0x08 /* Snews 2.0 */
- #define LEFT 0x4b
- #define RIGHT 0x4d
- #define Fn1 0x3b
- #define Fn2 0x3c
- #define Fn3 0x3d
-
- #define EX_DONE 1
- #define EX_QUIT 2
- #define EX_SAVE 3
- #define EX_NEXT 4
- #define EX_PREV 5
- #define EX_NEXT_UNREAD 6
- #define EX_ROT13 7
- #define EX_DUMMY 8
- #define EX_NOTREAD 128
- #define EX_SEARCH_FORW 9 /* Snews 2.0 */
- #define EX_SEARCH_BACKW 10 /* Snews 2.0 */
- #define EX_PREVIOUS 11 /* Snews 2.0 */
- #define EX_FIRST 12
- #define EX_LAST 13
- #define TEXT_LINE 5
-
-
- #define PAGE_HEADER 4
- #define PAGE_LENGTH (scr_rows - 6)
- #define PAGE_SIZE (scr_rows) /* Snews 2.0 */
-
- /* if you change these see show_help */
- #define HELP_GROUP 0
- #define HELP_THREAD 1
- #define HELP_ARTICLES 2
-
- #define UP_ARR 'H'
- #define DN_ARR 'P'
- #define LT_ARR 'K'
- #define RT_ARR 'M'
- #define C_L_ARR 's' /* Snews 2.0 */
- #define C_R_ARR 't' /* Snews 2.0 */
- #define C_UP_ARR 0x8D /* Snews 2.0 */
- #define C_DN_ARR 0x91 /* Snews 2.0 */
- #define PGUP 'I'
- #define PGDN 'Q'
- #define HOME 'G'
- #define END 'O'
- #define CTRLP 0x10 /* Snews 2.0 */
-
-
-
- /*
- * This structure allows the creation of linked list of article numbers
- */
- typedef struct art_id {
- long id; /* article number */
- long art_off; /* offset of the article */
- struct art_id *next_art; /* pointer to next article number */
- struct art_id *prev_art; /* pointer to last article number */
- } ART_ID;
-
- /*
- * This structure is a doubly linked list of the unique article headers. The
- * linked list of article numbers is built on 'art_num'. This system
- * is allows flexible use of memory, but will get slower by n'ish
- * and there is a fair degree of allocation overhead in the ART_ID structure
- * But hey, it's simple
- */
- typedef struct article {
- char header[60]; /* article header */
- int num_articles; /* number with this header */
- ART_ID *art_num; /* pointer to list of articles */
- struct article *next; /* next topic */
- struct article *last; /* last topic */
- int index; /* topic number from start */
- struct article *left; /* for tree structure */
- struct article *right;
- } ARTICLE;
-
-
- /*
- * This structure is the handle for an article in ram. The file
- * is read in and the linked list built.
- */
- typedef struct {
- char *author; /* truncated author */
- char *organisation; /* truncated organisation */
- char post_date[48]; /* date of posting NJL */
- char *follow_up; /* group for follow-up article */
- char *subject; /* Article Subject */
- char *newsgroup; /* The newsgroup of the article */
- char *distribution; /* The article distribution */
- char *references; /* The references header line */
- int lines; /* total lines in file */
- LINES *top; /* points to start of article, incl header */
- LINES *start; /* points to start of text */
- } TEXT;
-
- /*
- * This structure holds the list of messages to be sent via SMTP
- * when mail is sent (or an article is posted via mail)
- */
-
- typedef struct wrk_file {
- char next_site[80]; /* Next site to contact */
- char from[80]; /* Message is from */
- char to[80]; /* Mail addressed to */
- long seq; /* sequence No. for this item */
- struct wrk_file *next; /* Points to next entry */
- } WRK_FILE;
-
-
-
- ACTIVE *select_group(ACTIVE *head, ACTIVE *current);
- void show_help(int h);
- void show_values(void);
- void change_values(void);
- int read_group(ACTIVE *gp);
- void show_groups(ACTIVE **top, ACTIVE *this_group, int force, ACTIVE *head);
- ARTICLE *get_headers(ACTIVE *gp);
- void eat_gunk(char *buf);
- void free_header(ARTICLE *start);
-
-
- void show_threads(ACTIVE *gp, ARTICLE **top, ARTICLE *this_thread, int force, ARTICLE *head);
- int select_thread(ACTIVE *gp, ARTICLE *head);
- ARTICLE *search_thread(ACTIVE *gp, ARTICLE *head, int search_body, int direction);
- ACTIVE *search_for_group(ACTIVE *group, int direction);
- int read_thread(ACTIVE *gp, ARTICLE *this_thread, ART_ID *first, int a_ct);
- int mark_thread_as_read(ACTIVE *gp, ARTICLE *this_thread, int ask);
- void mark_thread_as_unread(ACTIVE *gp, ARTICLE *this_thread);
- int smartcmp(char *str1, char *str2);
- int strip_off_part(char *str);
- char *skip_vi(char *str);
-
- int count_unread_in_thread(ACTIVE *gp, ARTICLE *a);
- int count_unread_in_group(ACTIVE *gp);
- int mark_group_as_read(ACTIVE *gp, int ask);
- void mark_group_as_unread(ACTIVE *gp);
-
- void command(char *msg);
- void message(char *msg);
- void lmessage(char *msg);
-
- TEXT *load_article(char *fnx, long offset, int warn);
- void free_article(TEXT *t);
-
-
- int read_article(ACTIVE *gp, TEXT *tx, ARTICLE *this_article, int a_ct, ART_ID *id);
- void show_article(ACTIVE *gp, TEXT *tx, char *subject, LINES *this_line, int a_ct,
- int of_ct);
-
-
- void save_to_disk(ACTIVE *gp, long offset);
- void print_article(ACTIVE *gp, long offset);
- void print_thread(ACTIVE *gp, ARTICLE *art);
- void reply_to_article(TEXT *tx, char *subject);
- void get_his_stuff(TEXT *tx, char *author, char *msg_id, char *r_name);
- void ReplyAddress(TEXT *tx, char *subject);
-
- WRK_FILE *parse(char *name, int ismail);
-
- int post(TEXT *tx, char *newsgroups, char *subject);
- int post_header(TEXT *tx, FILE *article, char *newsgroups, char *subject, char *msg_id, int lct);
- int post_it(char *article, char *newsgroups);
-
- void rot13(TEXT *tx);
-
- void expand_tabs(char *buf, int max_len);
-
- int newsgroups_valid(char *ng);
-
- void mail_to_someone(TEXT *tx);
- void free_wrk(WRK_FILE *wrk);
- void pass_to_smtp(char *name, WRK_FILE *wrk, int ismail);
-
- void save_group_to_disk(ACTIVE *gp);
- void save_thread_to_disk(ACTIVE *gp, ARTICLE *this_thread);
-
- int make_header(FILE *tmp, char *subject, char *author, char *cc, char *bc, int *lct);
-
- void bug_report(void);
-
- extern char *dow[];
- extern char *mth[];
-
-